{% extends "orga/base.html" %}

{% load compress %}
{% load i18n %}
{% load rules %}
{% load static %}

{% block extra_title %}{% translate "Dashboard" %} :: {% endblock extra_title %}

{% block stylesheets %}
    {% compress css %}
        <link rel="stylesheet" href="{% static "orga/css/dashboard.css" %}">
    {% endcompress %}
{% endblock stylesheets %}

{% block content %}
    {% has_perm "base.create_event" request.user request.user as can_create_event %}

    {% if current_orga_events or past_orga_events or can_create_event %}
        <form class="mb-4 m-2">
            <input type="text" name="q" class="form-control" value="{% if request.GET.q %}{{ request.GET.q }}{% endif %}" placeholder="{% translate "Search" %}">
        </form>
        {% if current_orga_events or can_create_event %}
            <h2>{% translate "Your upcoming events" %}</h2>
            <div class="dashboard-list">
                {% for event in current_orga_events %}
                    {% include "orga/includes/dashboard_block_event.html" %}
                {% endfor %}
                {% if can_create_event %}
                    <a class="dashboard-block symbol" href="{% url "eventyay_common:events.add" %}">
                        <i class="fa fa-plus-circle" title="{% translate "Create a new event" %}"></i>
                    </a>
                {% endif %}
            </div>
        {% endif %}
        {% if past_orga_events %}
            <h2>{% translate "Your most recent events" %}</h2>
            <div class="dashboard-list">
                {% for event in past_orga_events %}
                    {% include "orga/includes/dashboard_block_event.html" %}
                {% endfor %}
            </div>
        {% endif %}
    {% endif %}
    {% if not hide_speaker_events and speaker_events %}
        <div class="alert alert-info">
            <div>
                {% translate "You are currently in the organizer area of eventyay. To view your submitted proposals, please go directly to the event page:" %}
                {% if speaker_events|length == 1 %}
                    <a href="{{ event.urls.user_submissions.full }}">{{ event.name }}</a>
                {% else %}
                    <ul class="mb-0">
                        {% for event in speaker_events %}
                            <li><a href="{{ event.urls.user_submissions.full }}">{{ event.name }}</a></li>
                        {% endfor %}
                    </ul>
                {% endif %}
            </div>
        </div>
    {% endif %}
{% endblock content %}
